<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Prismic::API
  
    &mdash; Documentation by YARD 0.8.7.4
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!Prismic/API.html";
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (A)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Prismic.html" title="Prismic (module)">Prismic</a></span></span>
     &raquo; 
    <span class="title">API</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: Prismic::API
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Prismic::API</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/prismic/api.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>The API is the main class</p>


  </div>
</div>
<div class="tags">
  

</div><h2>Defined Under Namespace</h2>
<p class="children">
  
    
  
    
      <strong class="classes">Classes:</strong> <span class='object_link'><a href="API/BadPrismicResponseError.html" title="Prismic::API::BadPrismicResponseError (class)">BadPrismicResponseError</a></span>, <span class='object_link'><a href="API/OAuth.html" title="Prismic::API::OAuth (class)">OAuth</a></span>, <span class='object_link'><a href="API/PrismicWSAuthError.html" title="Prismic::API::PrismicWSAuthError (class)">PrismicWSAuthError</a></span>, <span class='object_link'><a href="API/PrismicWSConnectionError.html" title="Prismic::API::PrismicWSConnectionError (class)">PrismicWSConnectionError</a></span>
    
  
</p>

  <h2>Constant Summary</h2>
  
    <dl class="constants">
      
        <dt id="warned_create_search_form-classvariable" class="">@@warned_create_search_form =
          
        </dt>
        <dd><pre class="code"><span class='kw'>false</span></pre></dd>
      
        <dt id="warned_oauth_initiate_url-classvariable" class="">@@warned_oauth_initiate_url =
          
        </dt>
        <dd><pre class="code"><span class='kw'>false</span></pre></dd>
      
        <dt id="warned_oauth_check_token-classvariable" class="">@@warned_oauth_check_token =
          
        </dt>
        <dd><pre class="code"><span class='kw'>false</span></pre></dd>
      
    </dl>
  




  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#access_token-instance_method" title="#access_token (instance method)">- (String) <strong>access_token</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#bookmarks-instance_method" title="#bookmarks (instance method)">- (Hash{String =&gt; String}) <strong>bookmarks</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>List of bookmarks, as name -&gt; documentId.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#cache-instance_method" title="#cache (instance method)">- (Object) <strong>cache</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute cache.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#experiments-instance_method" title="#experiments (instance method)">- (Experiments) <strong>experiments</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>List of all experiments from Prismic.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#forms-instance_method" title="#forms (instance method)">- (Hash{String =&gt; Form}) <strong>forms</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>List of forms, as name -&gt; Form.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#http_client-instance_method" title="#http_client (instance method)">- (Object) <strong>http_client</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute http_client.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#json-instance_method" title="#json (instance method)">- (Object) <strong>json</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute json.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#master-instance_method" title="#master (instance method)">- (Ref) <strong>master</strong> </a>
    

    
      (also: #master_ref)
    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the master <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">reference</a></span>.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth-instance_method" title="#oauth (instance method)">- (Object) <strong>oauth</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute oauth.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#refs-instance_method" title="#refs (instance method)">- (Hash{String =&gt; Ref}) <strong>refs</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>List of references, as label -&gt; reference.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#tags-instance_method" title="#tags (instance method)">- (Object) <strong>tags</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute tags.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#types-instance_method" title="#types (instance method)">- (Object) <strong>types</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the value of attribute types.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get-class_method" title="get (class method)">+ (Object) <strong>get</strong>(url, access_token = nil, http_client = Prismic::DefaultHTTPClient, api_cache = Prismic::DefaultCache) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Fetch the API information from the Prismic.io server.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth_check_token-class_method" title="oauth_check_token (class method)">+ (Object) <strong>oauth_check_token</strong>(url, oauth_params, api_opts = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth_initiate_url-class_method" title="oauth_initiate_url (class method)">+ (Object) <strong>oauth_initiate_url</strong>(url, oauth_opts, api_opts = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#parse_api_response-class_method" title="parse_api_response (class method)">+ (Object) <strong>parse_api_response</strong>(data, access_token, http_client, cache) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#start-class_method" title="start (class method)">+ (Object) <strong>start</strong>(url, opts = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#all-instance_method" title="#all (instance method)">- (Object) <strong>all</strong>(data = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Retrieve all documents (paginated).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#as_json-instance_method" title="#as_json (instance method)">- (Object) <strong>as_json</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#bookmark-instance_method" title="#bookmark (instance method)">- (String) <strong>bookmark</strong>(name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Get a bookmark by its name.</p>
</div></span>
  
</li>

      
        <li class="public deprecated">
  <span class="summary_signature">
    
      <a href="#create_search_form-instance_method" title="#create_search_form (instance method)">- (Object) <strong>create_search_form</strong>(name, data = {}, ref = {}) </a>
    

    
  </span>
  
  
  
  
  
  <span class="deprecated note title">deprecated</span>
  

  
    <span class="summary_desc"><strong>Deprecated.</strong> <div class='inline'><p>Use <span class='object_link'><a href="#form-instance_method" title="Prismic::API#form (method)">#form</a></span> instead.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#form-instance_method" title="#form (instance method)">- (SearchForm) <strong>form</strong>(name, data = {}, ref = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns a <span class='object_link'><a href="SearchForm.html" title="Prismic::SearchForm (class)">search form</a></span> by its name.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#getByID-instance_method" title="#getByID (instance method)">- (Object) <strong>getByID</strong>(id, data = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Retrieve one document by its id.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#getByIDs-instance_method" title="#getByIDs (instance method)">- (Object) <strong>getByIDs</strong>(ids, data = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Retrieve multiple documents by their ids.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#getByUID-instance_method" title="#getByUID (instance method)">- (Object) <strong>getByUID</strong>(typ, uid, data = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Retrieve one document by its uid.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#has_cache%3F-instance_method" title="#has_cache? (instance method)">- (Boolean) <strong>has_cache?</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Is the cache enabled on this API object?.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (API) <strong>initialize</strong>(json, access_token, http_client, cache) {|_self| ... }</a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A new instance of API.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth_check_token-instance_method" title="#oauth_check_token (instance method)">- (Object) <strong>oauth_check_token</strong>(params) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth_initiate_url-instance_method" title="#oauth_initiate_url (instance method)">- (Object) <strong>oauth_initiate_url</strong>(opts) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#preview_session-instance_method" title="#preview_session (instance method)">- (String) <strong>preview_session</strong>(token, link_resolver, default_url) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return the URL to display a given preview (usually the home page of your site).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#query-instance_method" title="#query (instance method)">- (Object) <strong>query</strong>(q, data = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Perform a query on this API.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#ref-instance_method" title="#ref (instance method)">- (Ref) <strong>ref</strong>(name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Get a <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">reference</a></span> by its alias.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Prismic::API (class)">API</a></span></tt>) <strong>initialize</strong>(json, access_token, http_client, cache) {|_self| ... }
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns a new instance of API</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>_self</tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
  
    <li>
      
        <span class='name'>_self</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Prismic::API (class)">Prismic::API</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the object that the method was called on</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="API/BadPrismicResponseError.html" title="Prismic::API::BadPrismicResponseError (class)">BadPrismicResponseError</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37
38
39
40
41
42
43
44
45</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 37</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span><span class='rparen'>)</span>
  <span class='ivar'>@json</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span>
  <span class='ivar'>@access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_access_token'>access_token</span>
  <span class='ivar'>@http_client</span> <span class='op'>=</span> <span class='id identifier rubyid_http_client'>http_client</span>
  <span class='kw'>yield</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='ivar'>@cache</span> <span class='op'>=</span> <span class='id identifier rubyid_cache'>cache</span>
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_master'>master</span> <span class='op'>=</span> <span class='id identifier rubyid_refs'>refs</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_refs'>refs</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_ref'>ref</span><span class='op'>|</span> <span class='id identifier rubyid_ref'>ref</span> <span class='kw'>if</span> <span class='id identifier rubyid_ref'>ref</span><span class='period'>.</span><span class='id identifier rubyid_master?'>master?</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>BadPrismicResponseError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>No master Ref found</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_master'>master</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="access_token-instance_method">
  
    - (<tt>String</tt>) <strong>access_token</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


11
12
13</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 11</span>

<span class='kw'>def</span> <span class='id identifier rubyid_access_token'>access_token</span>
  <span class='ivar'>@access_token</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="bookmarks=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="bookmarks-instance_method">
  
    - (<tt>Hash{String =&gt; String}</tt>) <strong>bookmarks</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns list of bookmarks, as name -&gt; documentId</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash{String =&gt; String}</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>list of bookmarks, as name -&gt; documentId</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


16
17
18</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 16</span>

<span class='kw'>def</span> <span class='id identifier rubyid_bookmarks'>bookmarks</span>
  <span class='ivar'>@bookmarks</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="cache=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="cache-instance_method">
  
    - (<tt>Object</tt>) <strong>cache</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute cache</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 19</span>

<span class='kw'>def</span> <span class='id identifier rubyid_cache'>cache</span>
  <span class='ivar'>@cache</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="experiments=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="experiments-instance_method">
  
    - (<tt><span class='object_link'><a href="Experiments.html" title="Prismic::Experiments (class)">Experiments</a></span></tt>) <strong>experiments</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns list of all experiments from Prismic</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Experiments.html" title="Prismic::Experiments (class)">Experiments</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>list of all experiments from Prismic</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


21
22
23</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 21</span>

<span class='kw'>def</span> <span class='id identifier rubyid_experiments'>experiments</span>
  <span class='ivar'>@experiments</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="forms=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="forms-instance_method">
  
    - (<tt>Hash{String =&gt; <span class='object_link'><a href="Form.html" title="Prismic::Form (class)">Form</a></span>}</tt>) <strong>forms</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns list of forms, as name -&gt; Form</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash{String =&gt; <span class='object_link'><a href="Form.html" title="Prismic::Form (class)">Form</a></span>}</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>list of forms, as name -&gt; Form</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 18</span>

<span class='kw'>def</span> <span class='id identifier rubyid_forms'>forms</span>
  <span class='ivar'>@forms</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="http_client-instance_method">
  
    - (<tt>Object</tt>) <strong>http_client</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute http_client</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


12
13
14</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 12</span>

<span class='kw'>def</span> <span class='id identifier rubyid_http_client'>http_client</span>
  <span class='ivar'>@http_client</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="json-instance_method">
  
    - (<tt>Object</tt>) <strong>json</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute json</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


9
10
11</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 9</span>

<span class='kw'>def</span> <span class='id identifier rubyid_json'>json</span>
  <span class='ivar'>@json</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="master=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="master-instance_method">
  
    - (<tt><span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">Ref</a></span></tt>) <strong>master</strong> 
  

  
    <span class="aliases">Also known as:
    <span class="names"><span id='master_ref-instance_method'>master_ref</span></span>
    </span>
  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the master <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">reference</a></span></p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">Ref</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The master <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">reference</a></span></p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 34</span>

<span class='kw'>def</span> <span class='id identifier rubyid_master'>master</span>
  <span class='ivar'>@master</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="oauth=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="oauth-instance_method">
  
    - (<tt>Object</tt>) <strong>oauth</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute oauth</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 19</span>

<span class='kw'>def</span> <span class='id identifier rubyid_oauth'>oauth</span>
  <span class='ivar'>@oauth</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="refs=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="refs-instance_method">
  
    - (<tt>Hash{String =&gt; <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">Ref</a></span>}</tt>) <strong>refs</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns list of references, as label -&gt; reference</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash{String =&gt; <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">Ref</a></span>}</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>list of references, as label -&gt; reference</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


14
15
16</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 14</span>

<span class='kw'>def</span> <span class='id identifier rubyid_refs'>refs</span>
  <span class='ivar'>@refs</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="tags=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="tags-instance_method">
  
    - (<tt>Object</tt>) <strong>tags</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute tags</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 19</span>

<span class='kw'>def</span> <span class='id identifier rubyid_tags'>tags</span>
  <span class='ivar'>@tags</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="types=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="types-instance_method">
  
    - (<tt>Object</tt>) <strong>types</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the value of attribute types</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 19</span>

<span class='kw'>def</span> <span class='id identifier rubyid_types'>types</span>
  <span class='ivar'>@types</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="get-class_method">
  
    + (<tt>Object</tt>) <strong>get</strong>(url, access_token = nil, http_client = Prismic::DefaultHTTPClient, api_cache = Prismic::DefaultCache) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Fetch the API information from the Prismic.io server</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 151</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='op'>=</span><span class='const'>Prismic</span><span class='op'>::</span><span class='const'>DefaultHTTPClient</span><span class='comma'>,</span> <span class='id identifier rubyid_api_cache'>api_cache</span><span class='op'>=</span><span class='const'>Prismic</span><span class='op'>::</span><span class='const'>DefaultCache</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>access_token</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_access_token'>access_token</span> <span class='kw'>if</span> <span class='id identifier rubyid_access_token'>access_token</span>
  <span class='id identifier rubyid_cache_key'>cache_key</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>?</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>#</span><span class='tstring_end'>&#39;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
  <span class='id identifier rubyid_api_cache'>api_cache</span><span class='period'>.</span><span class='id identifier rubyid_get_or_set'>get_or_set</span><span class='lparen'>(</span><span class='id identifier rubyid_cache_key'>cache_key</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='int'>5</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
    <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Accept</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='kw'>case</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
    <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>200</span><span class='tstring_end'>&#39;</span></span>
      <span class='id identifier rubyid_res'>res</span>
    <span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>401</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>403</span><span class='tstring_end'>&#39;</span></span>
      <span class='kw'>begin</span>
        <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_raise'>raise</span> <span class='const'>PrismicWSAuthError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
          <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>error</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
          <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>oauth_initiate</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
          <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>oauth_token</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
          <span class='id identifier rubyid_http_client'>http_client</span>
        <span class='rparen'>)</span>
      <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
        <span class='id identifier rubyid_raise'>raise</span> <span class='const'>PrismicWSConnectionError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_res'>res</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>else</span>
      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>PrismicWSConnectionError</span><span class='comma'>,</span> <span class='id identifier rubyid_res'>res</span>
    <span class='kw'>end</span>
  <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="oauth_check_token-class_method">
  
    + (<tt>Object</tt>) <strong>oauth_check_token</strong>(url, oauth_params, api_opts = {}) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


229
230
231
232
233
234
235
236
237
238</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 229</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oauth_check_token'>oauth_check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_params'>oauth_params</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_oauth'>oauth</span> <span class='op'>=</span>
      <span class='kw'>begin</span>
        <span class='id identifier rubyid_api'>api</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_oauth'>oauth</span>
      <span class='kw'>rescue</span> <span class='const'>PrismicWSAuthError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
        <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_oauth'>oauth</span>
      <span class='kw'>end</span>
  <span class='id identifier rubyid_oauth'>oauth</span><span class='period'>.</span><span class='id identifier rubyid_check_token'>check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_oauth_params'>oauth_params</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="oauth_initiate_url-class_method">
  
    + (<tt>Object</tt>) <strong>oauth_initiate_url</strong>(url, oauth_opts, api_opts = {}) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


209
210
211
212
213
214
215
216
217
218</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 209</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oauth_initiate_url'>oauth_initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_oauth'>oauth</span> <span class='op'>=</span>
      <span class='kw'>begin</span>
        <span class='id identifier rubyid_api'>api</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rparen'>)</span>
        <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_oauth'>oauth</span>
      <span class='kw'>rescue</span> <span class='const'>PrismicWSAuthError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
        <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_oauth'>oauth</span>
      <span class='kw'>end</span>
  <span class='id identifier rubyid_oauth'>oauth</span><span class='period'>.</span><span class='id identifier rubyid_initiate_url'>initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="parse_api_response-class_method">
  
    + (<tt>Object</tt>) <strong>parse_api_response</strong>(data, access_token, http_client, cache) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 190</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse_api_response'>parse_api_response</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_data_forms'>data_forms</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>forms</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
  <span class='id identifier rubyid_data_refs'>data_refs</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>refs</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='lbrace'>{</span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>BadPrismicResponseError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No refs given</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
  <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_api'>api</span><span class='op'>|</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_bookmarks'>bookmarks</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bookmarks</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_forms'>forms</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_data_forms'>data_forms</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_form'>form</span><span class='op'>|</span>
      <span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='const'>Form</span><span class='period'>.</span><span class='id identifier rubyid_from_json'>from_json</span><span class='lparen'>(</span><span class='id identifier rubyid_api'>api</span><span class='comma'>,</span> <span class='id identifier rubyid_form'>form</span><span class='rparen'>)</span><span class='rbracket'>]</span>
    <span class='rbrace'>}</span><span class='rbracket'>]</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_refs'>refs</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_data_refs'>data_refs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_ref'>ref</span><span class='op'>|</span>
      <span class='id identifier rubyid_scheduled_at'>scheduled_at</span> <span class='op'>=</span> <span class='id identifier rubyid_ref'>ref</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>scheduledAt</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
      <span class='lbracket'>[</span><span class='id identifier rubyid_ref'>ref</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>label</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='comma'>,</span> <span class='const'>Ref</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ref</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>label</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>isMasterRef</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_scheduled_at'>scheduled_at</span> <span class='op'>&amp;&amp;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_scheduled_at'>scheduled_at</span> <span class='op'>/</span> <span class='float'>1000.0</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rbracket'>]</span>
    <span class='rbrace'>}</span><span class='rbracket'>]</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_tags'>tags</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>tags</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_types'>types</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>types</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_oauth'>oauth</span> <span class='op'>=</span> <span class='const'>OAuth</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>oauth_initiate</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>oauth_token</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_api'>api</span><span class='period'>.</span><span class='id identifier rubyid_experiments'>experiments</span> <span class='op'>=</span> <span class='const'>Experiments</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>experiments</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
  <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="start-class_method">
  
    + (<tt>Object</tt>) <strong>start</strong>(url, opts = {}) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


178
179
180
181
182
183
184
185
186
187
188</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 178</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_http_client'>http_client</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:http_client</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Prismic</span><span class='op'>::</span><span class='const'>DefaultHTTPClient</span>
  <span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:access_token</span><span class='rbracket'>]</span>
  <span class='comment'># We don&#39;t use ||= because we want to keep the DefaultCache if nil was explicitly passed
</span>  <span class='id identifier rubyid_api_cache'>api_cache</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:api_cache</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:api_cache</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='const'>Prismic</span><span class='op'>::</span><span class='const'>DefaultCache</span>
  <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:cache</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:cache</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='const'>Prismic</span><span class='op'>::</span><span class='const'>DefaultCache</span>

  <span class='id identifier rubyid_resp'>resp</span> <span class='op'>=</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='comma'>,</span> <span class='id identifier rubyid_api_cache'>api_cache</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_resp'>resp</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_parse_api_response'>parse_api_response</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='comma'>,</span> <span class='id identifier rubyid_access_token'>access_token</span><span class='comma'>,</span> <span class='id identifier rubyid_http_client'>http_client</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="all-instance_method">
  
    - (<tt>Object</tt>) <strong>all</strong>(data = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Retrieve all documents (paginated)</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>query options (page, pageSize, ref, etc.)</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


96
97
98
99</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 96</span>

<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_ref'>ref</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ref</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_master'>master</span><span class='period'>.</span><span class='id identifier rubyid_ref'>ref</span>
  <span class='id identifier rubyid_form'>form</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>everything</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="as_json-instance_method">
  
    - (<tt>Object</tt>) <strong>as_json</strong> 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


146
147
148</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 146</span>

<span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span>
  <span class='ivar'>@json</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="bookmark-instance_method">
  
    - (<tt>String</tt>) <strong>bookmark</strong>(name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Get a bookmark by its name</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>The</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>bookmark&#39;s name</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The bookmark document id</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


52
53
54</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 52</span>

<span class='kw'>def</span> <span class='id identifier rubyid_bookmark'>bookmark</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_bookmarks'>bookmarks</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="create_search_form-instance_method">
  
    - (<tt>Object</tt>) <strong>create_search_form</strong>(name, data = {}, ref = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <div class="note deprecated"><strong>Deprecated.</strong> <div class='inline'><p>Use <span class='object_link'><a href="#form-instance_method" title="Prismic::API#form (method)">#form</a></span> instead.</p>
</div></div>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


78
79
80
81
82
83
84</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 78</span>

<span class='kw'>def</span> <span class='id identifier rubyid_create_search_form'>create_search_form</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>unless</span> <span class='cvar'>@@warned_create_search_form</span>
    <span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[DEPRECATION] `create_search_form` is deprecated.  Please use `form` instead.</span><span class='tstring_end'>&#39;</span></span>
    <span class='cvar'>@@warned_create_search_form</span> <span class='op'>=</span> <span class='kw'>true</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_form'>form</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="form-instance_method">
  
    - (<tt><span class='object_link'><a href="SearchForm.html" title="Prismic::SearchForm (class)">SearchForm</a></span></tt>) <strong>form</strong>(name, data = {}, ref = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns a <span class='object_link'><a href="SearchForm.html" title="Prismic::SearchForm (class)">search form</a></span> by its name. This is where you start to query a repository.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>name</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The name of the form</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>Default values</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>ref</span>
      
      
        <span class='type'>(<tt>type</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>Default <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">reference</a></span></p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="SearchForm.html" title="Prismic::SearchForm (class)">SearchForm</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The search form</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


72
73
74
75</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 72</span>

<span class='kw'>def</span> <span class='id identifier rubyid_form'>form</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_form'>form</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_forms'>forms</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span>
  <span class='id identifier rubyid_form'>form</span> <span class='kw'>and</span> <span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_create_search_form'>create_search_form</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_ref'>ref</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="getByID-instance_method">
  
    - (<tt>Object</tt>) <strong>getByID</strong>(id, data = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Retrieve one document by its id</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>q</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the query to perform</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>query options (page, pageSize, ref, etc.)</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>the document, or nil if not found</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


105
106
107</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 105</span>

<span class='kw'>def</span> <span class='id identifier rubyid_getByID'>getByID</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Predicates</span><span class='op'>::</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>document.id</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="getByIDs-instance_method">
  
    - (<tt>Object</tt>) <strong>getByIDs</strong>(ids, data = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Retrieve multiple documents by their ids</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>q</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the query to perform</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>query options (page, pageSize, ref, etc.)</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>the document, or nil if not found</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


121
122
123</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 121</span>

<span class='kw'>def</span> <span class='id identifier rubyid_getByIDs'>getByIDs</span><span class='lparen'>(</span><span class='id identifier rubyid_ids'>ids</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Predicates</span><span class='op'>::</span><span class='id identifier rubyid_in'>in</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>document.id</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="getByUID-instance_method">
  
    - (<tt>Object</tt>) <strong>getByUID</strong>(typ, uid, data = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Retrieve one document by its uid</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>q</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the query to perform</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>query options (page, pageSize, ref, etc.)</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>the document, or nil if not found</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


113
114
115</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 113</span>

<span class='kw'>def</span> <span class='id identifier rubyid_getByUID'>getByUID</span><span class='lparen'>(</span><span class='id identifier rubyid_typ'>typ</span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Predicates</span><span class='op'>::</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>my.</span><span class='tstring_end'>&#39;</span></span><span class='op'>+</span><span class='id identifier rubyid_typ'>typ</span><span class='op'>+</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.uid</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_uid'>uid</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="has_cache?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>has_cache?</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Is the cache enabled on this API object?</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 26</span>

<span class='kw'>def</span> <span class='id identifier rubyid_has_cache?'>has_cache?</span>
  <span class='op'>!</span><span class='op'>!</span><span class='id identifier rubyid_cache'>cache</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="oauth_check_token-instance_method">
  
    - (<tt>Object</tt>) <strong>oauth_check_token</strong>(params) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


240
241
242
243
244
245
246
247</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 240</span>

<span class='kw'>def</span> <span class='id identifier rubyid_oauth_check_token'>oauth_check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
  <span class='kw'>unless</span> <span class='cvar'>@@warned_oauth_check_token</span>
    <span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[DEPRECATION] Method `API#oauth_check_token` is deprecated.  </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
             <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please use `Prismic::API.oauth_check_token` instead.</span><span class='tstring_end'>&quot;</span></span>
    <span class='cvar'>@@warned_oauth_check_token</span> <span class='op'>=</span> <span class='kw'>true</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_oauth'>oauth</span><span class='period'>.</span><span class='id identifier rubyid_check_token'>check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="oauth_initiate_url-instance_method">
  
    - (<tt>Object</tt>) <strong>oauth_initiate_url</strong>(opts) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


220
221
222
223
224
225
226
227</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 220</span>

<span class='kw'>def</span> <span class='id identifier rubyid_oauth_initiate_url'>oauth_initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='op'>!</span><span class='cvar'>@@warned_oauth_initiate_url</span>
    <span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[DEPRECATION] Method `API#oauth_initiate_url` is deprecated.  </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
      <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please use `Prismic::API.oauth_initiate_url` instead.</span><span class='tstring_end'>&quot;</span></span>
    <span class='cvar'>@@warned_oauth_initiate_url</span> <span class='op'>=</span> <span class='kw'>true</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_oauth'>oauth</span><span class='period'>.</span><span class='id identifier rubyid_initiate_url'>initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="preview_session-instance_method">
  
    - (<tt>String</tt>) <strong>preview_session</strong>(token, link_resolver, default_url) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Return the URL to display a given preview
(usually the home page of your site)</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>token</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>as received from Prismic server to identify the content to preview</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>link_resolver</span>
      
      
        <span class='type'></span>
      
      
      
        &mdash;
        <div class='inline'><p>the link resolver to build URL for your site</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>default_url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the URL to default to return if the preview doesn&#39;t correspond to a document</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the URL to redirect the user to</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


132
133
134
135
136
137
138
139
140
141
142
143
144</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 132</span>

<span class='kw'>def</span> <span class='id identifier rubyid_preview_session'>preview_session</span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='comma'>,</span> <span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='comma'>,</span> <span class='id identifier rubyid_default_url'>default_url</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_http_client'>http_client</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Accept</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>200</span><span class='tstring_end'>&#39;</span></span>
    <span class='kw'>return</span> <span class='id identifier rubyid_default_url'>default_url</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_documents'>documents</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>everything</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='const'>Prismic</span><span class='op'>::</span><span class='const'>Predicates</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>document.id</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>mainDocument</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_token'>token</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='id identifier rubyid_documents'>documents</span><span class='period'>.</span><span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&gt;</span> <span class='int'>0</span>
    <span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='period'>.</span><span class='id identifier rubyid_link_to'>link_to</span><span class='lparen'>(</span><span class='id identifier rubyid_documents'>documents</span><span class='period'>.</span><span class='id identifier rubyid_results'>results</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_default_url'>default_url</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="query-instance_method">
  
    - (<tt>Object</tt>) <strong>query</strong>(q, data = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Perform a query on this API. Use the master reference is no ref is specified in data.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>q</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the query to perform</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>query options (page, pageSize, ref, etc.)</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


89
90
91
92</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 89</span>

<span class='kw'>def</span> <span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_q'>q</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_ref'>ref</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ref</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_master'>master</span><span class='period'>.</span><span class='id identifier rubyid_ref'>ref</span>
  <span class='id identifier rubyid_form'>form</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>everything</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_q'>q</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_submit'>submit</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="ref-instance_method">
  
    - (<tt><span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">Ref</a></span></tt>) <strong>ref</strong>(name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Get a <span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">reference</a></span> by its alias</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>name</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The reference&#39;s alias</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Ref.html" title="Prismic::Ref (class)">Ref</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The reference</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic/api.rb', line 61</span>

<span class='kw'>def</span> <span class='id identifier rubyid_ref'>ref</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_refs'>refs</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Tue Sep 27 10:47:06 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.4 (ruby-2.0.0).
</div>

  </body>
</html>